package com.zelin.pojo;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Student implements Serializable {
    @TableId(type = IdType.ASSIGN_ID)  //使用idworer生成器生成的唯一id
    private Long sid;

    private String sname;

    private String sex;

    private Integer age;

    private String addr;

    private Integer cid;

    // 设置字段不存在
    @TableField(exist = false)
    private String cname;

    // 自动填充
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    // 逻辑删除
    @TableLogic
    private int deleted;

    // 乐观锁
    @Version
    @TableField(fill = FieldFill.INSERT)
    private int version;

}